<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    response.setHeader("cache-control","public");
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <title>试题预览</title>
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/font/font-awesome.min.css">
    <!--[if IE 7]>
    <link rel="stylesheet" href="<%=path%>/static/css/font/font-awesome-ie7.min.css"><![endif]-->
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/common.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/examMng/core.css">
    <link rel="stylesheet" href="<%=path%>/static/css/examMng/examMng.css"/>
    <!--bootstrap基础引用 start-->
	<script type="text/javascript" src="<%=path%>/static/jstreeview/bootstrap/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="<%=path%>/static/js/bootstrap.min.js"></script>
	<!--bootstrap基础引用 end-->
	<!--bootstrap-dialog start-->
	<link rel="stylesheet" type="text/css" href="<%=path%>/static/jstreeview/plugins/bootstrap-dialog/bootstrap-dialog.min.css">
	<script type="text/javascript" src="<%=path%>/static/jstreeview/plugins/bootstrap-dialog/bootstrap-dialog.min.js"></script>
	<!--bootstrap-dialog end-->
    <style type="text/css">
        .ico {
            float: right;
            margin-right: 20px;
            font-size: 16px;
        }

        .bj {
            width: 120px;
            height: 30px;
            top: 17px;
            position: absolute;
            right: 5px;
            z-index: 999;
            background: #fff;
        }

        #pageBox {
            padding: 10px 0 0 0;
            width: 1088px;
            margin: 0 auto;
            text-align: center;
        }

        #pageBox span {
            display: inline-block;
            width: 60px;
            height: 24px;
            line-height: 24px;
            text-align: center;
            color: #fff;
            background: #4c4ca6;

        }

        #pageNav {
            display: inline-block;
        }

        #pageNav a {
            display: inline-block;
            width: 24px;
            height: 24px;
            line-height: 24px;
            text-align: center;
            color: #4c4ca6;
            text-decoration: none;
        }

        #pageNav a.active, #pageNav a:hover {
            background: #4c4ca6;
            color: #EFEFEF;
        }

        #prev:hover {
            cursor: pointer;
        }

        #next:hover {
            cursor: pointer;
        }
    </style>
    <script src="<%=path%>/static/js/respond.js"></script>
    <script src="<%=path%>/static/js/jquery-1.9.1.min.js"></script>
    <script src="<%=path%>/static/js/jquery-2.0.3.min.js"></script>
    <script src="<%=path%>/static/js/jquery.z-pager.js" type="text/javascript" charset="utf-8"></script>
    <script src="<%=path%>/static/js/examMng/right-btn.js"></script>
</head>
<body>

<jsp:include page="../head.jsp" flush="true"/>

<!--body begin-->
<div class="main-container">
    <div class="container info-add body-box" >
        <div class="info-add-box" style="background: #4c4ca6;">
            <p>${content.title}-${qutype.name }</p>
            <a href="javascript:history.go(-1);"><i
                    class="glyphicon glyphicon-arrow-left"></i>&nbsp;返回</a>
        </div>

        <div class="view-container">

            <div class="container-title">
                <span class="font-weight">${qutype.name }</span>
                <div class="searchbox" style="margin-top: 0px;">
                    <input type="text" class="form-control search"
                           style="height: 25px;" placeholder="请输入检索条件"> <i
                        id="but" class="glyphicon glyphicon-search"
                        style="top: 3px; font-size: 18px;"></i>
                </div>
                <!-- <span class="fbt">（共12道）</span> -->
            </div>

            <div class="view-content" id="pageMain">
                <span style="padding-left: 40px"></span>
                <!--  <input type="checkbox" id="all">
               <a href="#" id="selectAll">全选</a>
                <a href="#" id="reverse">反选</a> -->
                <div id="show">
                    <c:forEach items="${resultList }" var="result">
                        <div class="view-box">
                            <div class="view-title">
                                <label class="input-check">
                                    <input name="selectQuestions" type="checkbox" value="${result.id}">
                                </label>
                                <div class="word">
                                    <span>${result.title }</span>
                                </div>
                                <div class="bj">
                                    <div class="bjbtn_content">
                                        <a href="javascript:doPost('<%=basePath%>depository/toUpdateQuestion')"
                                           style="display: inline;">
                                            <i class="glyphicon glyphicon-pencil"></i>编辑</a>
                                        <a href="#" onclick="delQuestion();" style="display: inline;"><i
                                                class="glyphicon glyphicon-trash"></i>删除</a>
                                    </div>
                                </div>
                            </div>
                            <div class="view-choose-box">
                                    <%-- <c:forEach items="${result.optionList }" var="option">--%>
                                <div class="radio">
                                    <label class="choose">
                                        <input type="radio" name="optionsRadios1" value="option2"
                                               disabled>
                                        <p>A:${result.a}</p>
                                    </label>
                                </div>
                                <div class="radio">
                                    <label class="choose">
                                        <input type="radio" name="optionsRadios1" value="option2" disabled>
                                        <p>B:${result.b}</p>
                                    </label>
                                </div>
                                <c:if test="${result.questiontype_id ne 3}">
                                    <div class="radio">
                                        <label class="choose">
                                            <input type="radio" name="optionsRadios1" value="option2" disabled>
                                            <p>C:${result.c}</p>
                                        </label>
                                    </div>
                                    <div class="radio">
                                        <label class="choose">
                                            <input type="radio" name="optionsRadios1" id="optionsRadios2" value="option2" disabled>
                                            <p>D:${result.d}</p>
                                        </label>
                                    </div>
                                </c:if>

                                    <%--<c:choose>
                                        <c:when test="${not empty option.picture && !(option.picture eq null) }">
                                            <p>${option.title }</p>
                                            <img style="width: 120px; height: 120px;"
                                                 src="<%=basePath %>${option.picture }">
                                        </c:when>
                                        <c:otherwise>
                                            <p>${option.title }</p>
                                        </c:otherwise>
                                    </c:choose>
                                    <%--</c:forEach>--%>
                            </div>
                            <div class="answer-box">
                                <span class="right-line"></span> <span>正确答案：<b>${result.answer }</b></span>
                            </div>
                        </div>
                        <div style="height: 60px;"></div>
                    </c:forEach>
                </div>
            </div>
            <div id="pageBox">
                <span id="prev">上一页</span>
                <ul id="pageNav" ></ul>
                <span id="next">下一页</span>
            </div>
        </div>
    </div>
</div>
<!--body end-->
<script type="text/javascript">
    $(function () {

        //试卷管理
        if (${role eq 'master'}) {
            $('#topMain').children().eq(0).addClass('active'); // 追加样式;
            $('#topMain').children().eq(0).children().attr('href', '#');
        } else if (${role eq 'trainee'}) {
            $('#topMain').children().eq(0).addClass('active'); // 追加样式;
            $('#topMain').children().eq(0).children().attr('href', '#');
        } else {
            $('#topMain').children().eq(3).addClass('active'); // 追加样式;
            // $('#topMain').children().eq(3).children().attr('href', '#');
        }
    })

    function delQuestion() {

        var strgetSelectValue = "";
        $("input[name='selectQuestions']:checked").each(function (j) {
            if (j >= 0) {
                strgetSelectValue += $(this).val() + ","
            }
        });
        if (strgetSelectValue == "") {
        	BootstrapDialog.confirm({
				title : '提示',
				message : '请选择试题',
				size : BootstrapDialog.SIZE_SMALL,
				type : BootstrapDialog.TYPE_DEFAULT,
				closable : true,
				btnCancelLabel : '取消',
				btnOKLabel : '确定'
			});
            return;
        }
        BootstrapDialog.confirm({
            title : '提示',
            message : '您确认要删除该试题吗',
            size : BootstrapDialog.SIZE_SMALL,
            type : BootstrapDialog.TYPE_DEFAULT,
            closable : true,
            btnCancelLabel : '取消',
            btnOKLabel : '确认删除',
            callback:function(result){
                if (result) {
                    $.ajax({
                        type: "POST",
                        url: "<%=basePath%>depository/delQuestion",
                        data: {"delQuestionStr": strgetSelectValue},
                        success: function (data) {
                            if (data.status == 1) {
                                BootstrapDialog.confirm({
                                    title : '提示',
                                    message : data.msg,
                                    size : BootstrapDialog.SIZE_SMALL,
                                    type : BootstrapDialog.TYPE_DEFAULT,
                                    closable : true,
                                    btnCancelLabel : '取消',
                                    btnOKLabel : '确定',
                                    callback:function(result){
                                        window.location.reload();
                                    }
                                });
                            }
                        }
                    })
                }
            }
        });
        return;
    }

    function doPost(to) {  // to:提交动作（action）,p:参数
        var checkedValue = "";
        var label = false;
        $("input[name='selectQuestions']:checked").each(function (j) {
            if (j == 0) {
                checkedValue = $(this).val()
            } else {
            	BootstrapDialog.confirm({
    				title : '提示',
    				message : '请选择一道试题',
    				size : BootstrapDialog.SIZE_SMALL,
    				type : BootstrapDialog.TYPE_DEFAULT,
    				closable : true,
    				btnCancelLabel : '取消',
    				btnOKLabel : '确定'
    			});
                label = true;
            }
        });
        if (checkedValue == "") {
        	BootstrapDialog.confirm({
				title : '提示',
				message : '请选择试题',
				size : BootstrapDialog.SIZE_SMALL,
				type : BootstrapDialog.TYPE_DEFAULT,
				closable : true,
				btnCancelLabel : '取消',
				btnOKLabel : '确定'
			});
            label = true;
        }
        if (label) {
            return false;
        }
        var myForm = document.createElement("form");
        myForm.method = "post";
        myForm.action = to;
        var myInput = document.createElement("input");
        myInput.setAttribute("name", "questionId");  // 为input对象设置name
        myInput.setAttribute("value", checkedValue);  // 为input对象设置value
        myForm.appendChild(myInput);
        document.body.appendChild(myForm);
        myForm.submit();
        document.body.removeChild(myForm);  // 提交后移除创建的form
    }

    function updateQuestion() {
        var checkedValue = "";
        $("input[name='selectQuestions']:checked").each(function (j) {
            if (j == 1) {
                checkedValue = $(this).val()
            } else {
            	BootstrapDialog.confirm({
    				title : '提示',
    				message : '请选择一道试题',
    				size : BootstrapDialog.SIZE_SMALL,
    				type : BootstrapDialog.TYPE_DEFAULT,
    				closable : true,
    				btnCancelLabel : '取消',
    				btnOKLabel : '确定'
    			});
                return
            }
        });
        if (checkedValue == "") {
        	BootstrapDialog.confirm({
				title : '提示',
				message : '请选择试题',
				size : BootstrapDialog.SIZE_SMALL,
				type : BootstrapDialog.TYPE_DEFAULT,
				closable : true,
				btnCancelLabel : '取消',
				btnOKLabel : '确定'
			});
            return
        }

    }

    //搜索ajax
    //class="view-content" remove
    $("#but").click(function () {
        var keyword = $(this).prev().val();

        var myForm = document.createElement("form");
        myForm.method = "post";
        myForm.action = '<%=path%>/depository/toCheckQuestion';
        var ConId = document.createElement("input");
        ConId.setAttribute("name", "ConId");  // 为input对象设置name
        ConId.setAttribute("value", ${content.id });  // 为input对象设置value
        myForm.appendChild(ConId);
        var typeId = document.createElement("input");
        typeId.setAttribute("name", "typeId");  // 为input对象设置name
        typeId.setAttribute("value", ${typeId});  // 为input对象设置value
        myForm.appendChild(typeId);

        var keywordx = document.createElement("input");
        keywordx.setAttribute("name", "keyword");  // 为input对象设置name
        keywordx.setAttribute("value", keyword);  // 为input对象设置value
        myForm.appendChild(keywordx);
        
        var typeCount = document.createElement("input");
        typeCount.setAttribute("name", "typeCount");  // 为input对象设置name
        typeCount.setAttribute("value", ${typeCount});  // 为input对象设置value
        myForm.appendChild(typeCount);
        
        var myInput3 = document.createElement("input");  
        myInput3.setAttribute("name", "page_num");  // 为input对象设置name  
        myInput3.setAttribute("value", 0);  // 为input对象设置value
        myForm.appendChild(myInput3);
        var myInput4 = document.createElement("input");  
        myInput4.setAttribute("name", "page_size");  // 为input对象设置name  
        myInput4.setAttribute("value", 5);  // 为input对象设置value  
        myForm.appendChild(myInput4);

        document.body.appendChild(myForm);
        myForm.submit();
        document.body.removeChild(myForm);  // 提交后移除创建的form
        
      
        
        

    })

</script>
<script>
    $(function () {
        tabPage({
            pageMain: '#pageMain',
            pageNav: '#pageNav',
            pagePrev: '#prev',
            pageNext: '#next',
            curNum: 5, /*每页显示的条数*/
            activeClass: 'active', /*高亮显示的class*/
            ini: 0,/*初始化显示的页面*/
        });

        function tabPage(tabPage) {
            var typeCount =${typeCount};
            var typeId = ${typeId};
            var ConId = ${content.id};
            var pageMain = $(tabPage.pageMain);
            /*获取内容列表*/
            var pageNav = $(tabPage.pageNav);
            /*获取分页*/
            var pagePrev = $(tabPage.pagePrev);
            /*上一页*/
            var pageNext = $(tabPage.pageNext);
            /*下一页*/


            var curNum = tabPage.curNum;
            /*每页显示数*/
            var len = Math.ceil(typeCount / curNum);
            /*计算总页数*/
            var pageList = '';
            /*生成页码*/
            var iNum = 0;
            /*当前的索引值*/

            for (var i = 0; i < len; i++) {
                pageList += '<a href="javascript:;">' + (i + 1) + '</a>';
            }
            pageNav.html(pageList);
            /*头一页加高亮显示*/
            pageNav.find("a:first").addClass(tabPage.activeClass);

            /*******标签页的点击事件*******/
            pageNav.find("a").each(function () {

                $(this).click(function () {

                    pageNav.find("a").removeClass(tabPage.activeClass);
                    $(this).addClass(tabPage.activeClass);
                    iNum = $(this).index();
                    $.ajax({
                        type: "POST",
                        url: "<%=basePath%>depository/toCheckQuestionAjax",
                        data: {"page_num": iNum + 1, "page_size": curNum, "typeId": typeId, "ConId": ConId},
                        success: function (data) {
                            if (data.status == 1) {
                                var questionStr = "";
                                for (var i = 0; i < data.resultList.length; i++) {
                                    var singleQuesStr0 = '			<div class="view-box" > ' +
                                        '							<div class="view-title">' +
                                        '								<label class="input-check"> ' +
                                        '									<input name="selectQuestions" type="checkbox" value="' + data.resultList[i].id + '">' +
                                        '								</label>' +
                                        '								<div class="word">' +
                                        '									<span>' + data.resultList[i].title + '</span>' +
                                        '								</div> ' +
                                        '								<div class="bj" >' +
                                        '									<div class="bjbtn_content">' +
                                        '										<a href="javascript:doPost(\'<%=basePath%>depository/toUpdateQuestion\')"  style="display: inline;"><i' +
                                        '											class="glyphicon glyphicon-pencil"></i>编辑</a> ' +
                                        '										<a href="#" onclick="delQuestion();" style="display: inline;"><i class="glyphicon glyphicon-trash"></i>删除</a>' +
                                        '									</div>' +
                                        '				</div>' +
                                        '								' +
                                        '							</div> ' +
                                        '							<div class="view-choose-box">';
                                        var optionA = '									<div class="radio">' +
                                        '										<label class="choose"> ' +
                                        '											<input type="radio" name="optionsRadios1"   disabled> ' +
                                        '													<p>' + data.resultList[i].a + '</p>' +
                                        '										</label>' +
                                        '									</div>';
                                        var optionB = '									<div class="radio">' +
                                        '										<label class="choose"> ' +
                                        '											<input type="radio" name="optionsRadios2"   disabled> ' +
                                        '													<p>' + data.resultList[i].b + '</p>' +
                                        '										</label>' +
                                        '									</div>';
                                        var optionC = "";
                                        var optionD = "";
                                        if(data.resultList[i].c!=""&&data.resultList[i].c!=null){
                                        	optionC = '									<div class="radio">' +
                                            '										<label class="choose"> ' +
                                            '											<input type="radio" name="optionsRadios3"   disabled> ' +
                                            '													<p>' + data.resultList[i].c + '</p>' +
                                            '										</label>' +
                                            '									</div>';
                                        }
                                        if(data.resultList[i].d!=""&&data.resultList[i].d!=null){
                                        	optionD = '									<div class="radio">' +
                                            '										<label class="choose"> ' +
                                            '											<input type="radio" name="optionsRadios4"   disabled> ' +
                                            '													<p>' + data.resultList[i].d + '</p>' +
                                            '										</label>' +
                                            '									</div>';
                                        }
                                    var singleQuesStr1 = '							</div>' +
                                    ' <div class="answer-box">'+
                                    '                                <span class="right-line"></span> <span>正确答案：<b>'+data.resultList[i].answer+'</b></span>'+
                                    '                            </div>'+
                                    '							' +
                                    '						</div>';

                                    questionStr = questionStr + singleQuesStr0 + optionA + optionB+optionC+optionD+singleQuesStr1;
                                }
                                $("#show").html(questionStr);

                            }
                        }
                    })

                });
            })

            $(pageMain).find("li").hide();
            /************首页的显示*********/
            for (var i = 0; i < curNum; i++) {
                $(pageMain).find("li").eq(i).show()
            }
            
            /*下一页*/
            pageNext.click(function () {
                $(pageMain).find("li").hide();
                if (iNum == len - 1) {
                	BootstrapDialog.confirm({
        				title : '提示',
        				message : '已经是最后一页',
        				size : BootstrapDialog.SIZE_SMALL,
        				type : BootstrapDialog.TYPE_DEFAULT,
        				closable : true,
        				btnCancelLabel : '取消',
        				btnOKLabel : '确定'
        			});
                    for (var i = (len - 1) * curNum; i < len * curNum; i++) {
                        $(pageMain).find("li").eq(i).show()
                    }
                    return false;
                } else {
                    pageNav.find("a").removeClass(tabPage.activeClass);
                    iNum++;
                    pageNav.find("a").eq(iNum).addClass(tabPage.activeClass);
                    $.ajax({
                        type: "POST",
                        url: "<%=basePath%>depository/toCheckQuestionAjax",
                        data: {"page_num": iNum + 1, "page_size": curNum, "typeId": typeId, "ConId": ConId},
                        success: function (data) {
                            if (data.status == 1) {
                                var questionStr = "";
                                for (var i = 0; i < data.resultList.length; i++) {
                                    var singleQuesStr0 = '			<div class="view-box" > ' +
                                        '							<div class="view-title">' +
                                        '								<label class="input-check"> ' +
                                        '									<input name="selectQuestions" type="checkbox" value="' + data.resultList[i].id + '">' +
                                        '								</label>' +
                                        '								<div class="word">' +
                                        '									<span>' + data.resultList[i].title + '</span>' +
                                        '								</div> ' +
                                        '								<div class="bj" >' +
                                        '									<div class="bjbtn_content">' +
                                        '										<a href="javascript:doPost(\'<%=basePath%>depository/toUpdateQuestion\')"  style="display: inline;"><i' +
                                        '											class="glyphicon glyphicon-pencil"></i>编辑</a> ' +
                                        '										<a href="#" onclick="delQuestion();" style="display: inline;"><i class="glyphicon glyphicon-trash"></i>删除</a>' +
                                        '									</div>' +
                                        '				</div>' +
                                        '								' +
                                        '							</div> ' +
                                        '							<div class="view-choose-box">';
                                        var optionA = '									<div class="radio">' +
                                        '										<label class="choose"> ' +
                                        '											<input type="radio" name="optionsRadios1"   disabled> ' +
                                        '													<p>' + data.resultList[i].a + '</p>' +
                                        '										</label>' +
                                        '									</div>';
                                        var optionB = '									<div class="radio">' +
                                        '										<label class="choose"> ' +
                                        '											<input type="radio" name="optionsRadios2"   disabled> ' +
                                        '													<p>' + data.resultList[i].b + '</p>' +
                                        '										</label>' +
                                        '									</div>';
                                        var optionC = "";
                                        var optionD = "";
                                        if(data.resultList[i].c!=""&&data.resultList[i].c!=null){
                                        	optionC = '									<div class="radio">' +
                                            '										<label class="choose"> ' +
                                            '											<input type="radio" name="optionsRadios3"   disabled> ' +
                                            '													<p>' + data.resultList[i].c + '</p>' +
                                            '										</label>' +
                                            '									</div>';
                                        }
                                        if(data.resultList[i].d!=""&&data.resultList[i].d!=null){
                                        	optionD = '									<div class="radio">' +
                                            '										<label class="choose"> ' +
                                            '											<input type="radio" name="optionsRadios4"   disabled> ' +
                                            '													<p>' + data.resultList[i].d + '</p>' +
                                            '										</label>' +
                                            '									</div>';
                                        }
                                    var singleQuesStr1 = '							</div>' +
                                    ' <div class="answer-box">'+
                                    '                                <span class="right-line"></span> <span>正确答案：<b>'+data.resultList[i].answer+'</b></span>'+
                                    '                            </div>'+
                                    '							' +
                                    '						</div>';

                                    questionStr = questionStr + singleQuesStr0 + optionA + optionB+optionC+optionD+singleQuesStr1;
                                }
                                $("#show").html(questionStr);

                            }
                        }
                    })
//                    ini(iNum);
                }
                for (var i = iNum * curNum; i < (iNum + 1) * curNum; i++) {
                    $(pageMain).find("li").eq(i).show()
                }
            });
            /*上一页*/
            pagePrev.click(function () {
                $(pageMain).find("li").hide();
                if (iNum == 0) {
                	BootstrapDialog.confirm({
        				title : '提示',
        				message : '当前是第一页',
        				size : BootstrapDialog.SIZE_SMALL,
        				type : BootstrapDialog.TYPE_DEFAULT,
        				closable : true,
        				btnCancelLabel : '取消',
        				btnOKLabel : '确定'
        			});
                    for (var i = 0; i < curNum; i++) {
                        $(pageMain).find("li").eq(i).show()
                    }
                    return false;
                } else {
                    pageNav.find("a").removeClass(tabPage.activeClass);
                    iNum--;
                    pageNav.find("a").eq(iNum).addClass(tabPage.activeClass);
                    $.ajax({
                        type: "POST",
                        url: "<%=basePath%>depository/toCheckQuestionAjax",
                        data: {"page_num": iNum + 1, "page_size": curNum, "typeId": typeId, "ConId": ConId},
                        success: function (data) {
                            if (data.status == 1) {
                                var questionStr = "";
                                for (var i = 0; i < data.resultList.length; i++) {
                                    var singleQuesStr0 = '			<div class="view-box" > ' +
                                        '							<div class="view-title">' +
                                        '								<label class="input-check"> ' +
                                        '									<input name="selectQuestions" type="checkbox" value="' + data.resultList[i].id + '">' +
                                        '								</label>' +
                                        '								<div class="word">' +
                                        '									<span>' + data.resultList[i].title + '</span>' +
                                        '								</div> ' +
                                        '								<div class="bj" >' +
                                        '									<div class="bjbtn_content">' +
                                        '										<a href="javascript:doPost(\'<%=basePath%>depository/toUpdateQuestion\')"  style="display: inline;"><i' +
                                        '											class="glyphicon glyphicon-pencil"></i>编辑</a> ' +
                                        '										<a href="#" onclick="delQuestion();" style="display: inline;"><i class="glyphicon glyphicon-trash"></i>删除</a>' +
                                        '									</div>' +
                                        '				</div>' +
                                        '								' +
                                        '							</div> ' +
                                        '							<div class="view-choose-box">';
                                        var optionA = '									<div class="radio">' +
                                        '										<label class="choose"> ' +
                                        '											<input type="radio" name="optionsRadios1"   disabled> ' +
                                        '													<p>' + data.resultList[i].a + '</p>' +
                                        '										</label>' +
                                        '									</div>';
                                        var optionB = '									<div class="radio">' +
                                        '										<label class="choose"> ' +
                                        '											<input type="radio" name="optionsRadios2"   disabled> ' +
                                        '													<p>' + data.resultList[i].b + '</p>' +
                                        '										</label>' +
                                        '									</div>';
                                        var optionC = "";
                                        var optionD = "";
                                        if(data.resultList[i].c!=""&&data.resultList[i].c!=null){
                                        	optionC = '									<div class="radio">' +
                                            '										<label class="choose"> ' +
                                            '											<input type="radio" name="optionsRadios3"   disabled> ' +
                                            '													<p>' + data.resultList[i].c + '</p>' +
                                            '										</label>' +
                                            '									</div>';
                                        }
                                        if(data.resultList[i].d!=""&&data.resultList[i].d!=null){
                                        	optionD = '									<div class="radio">' +
                                            '										<label class="choose"> ' +
                                            '											<input type="radio" name="optionsRadios4"   disabled> ' +
                                            '													<p>' + data.resultList[i].d + '</p>' +
                                            '										</label>' +
                                            '									</div>';
                                        }
                                    var singleQuesStr1 = '							</div>' +
                                    ' <div class="answer-box">'+
                                    '                                <span class="right-line"></span> <span>正确答案：<b>'+data.resultList[i].answer+'</b></span>'+
                                    '                            </div>'+
                                    '							' +
                                    '						</div>';

                                    questionStr = questionStr + singleQuesStr0 + optionA + optionB+optionC+optionD+singleQuesStr1;
                                }
                                $("#show").html(questionStr);

                            }
                        }
                    })
                }
                for (var i = iNum * curNum; i < (iNum + 1) * curNum; i++) {
                    $(pageMain).find("li").eq(i).show()
                }
            })
        }
    })
    $("#all").click(function(){
        if(this.checked){
            $("#show :checkbox").prop("checked", true);
        }else{
            $("#show :checkbox").prop("checked", false);
        }
    });
    $("#all").click(function(){
        if(this.checked){
            $("#show :checkbox").prop("checked", true);
        }else{
            $("#show :checkbox").prop("checked", false);
        }
    });
    $("#selectAll").click(function () {
        $("#show :checkbox,#all").prop("checked", true);
    });
    $("#reverse").click(function () {
        $("#show :checkbox").each(function () {
            $(this).prop("checked", !$(this).prop("checked"));
        });
        allchk();
    });
    function allchk(){
        var chknum = $("#show :checkbox").size();//选项总个数
        var chk = 0;
        $("#list :checkbox").each(function () {
            if($(this).prop("checked")==true){
                chk++;
            }
        });
        if(chknum==chk){//全选
            $("#all").prop("checked",true);
        }else{//不全选
            $("#all").prop("checked",false);
        }
    }
</script>
</body>
</html>

